# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=py3-awesomeversion
pkgver=22.6.0
pkgrel=0
pkgdesc="Python module to deal with versions"
url="https://github.com/ludeeus/awesomeversion"
license="MIT"
arch="noarch"
depends="python3"
makedepends="py3-build py3-installer py3-poetry-core"
checkdepends="py3-pytest"
source="https://github.com/ludeeus/awesomeversion/archive/$pkgver/py3-awesomeversion-$pkgver.tar.gz
	version-placeholder.patch
	"
builddir="$srcdir/awesomeversion-$pkgver"

prepare() {
	default_prepare

	# set module version
	sed -i "s/@VERSION@/$pkgver/" pyproject.toml
}

build() {
	# poetry-core excludes files specified in .gitignore
	# fixed by setting GIT_DIR away from the aports tree's top-level directory
	GIT_DIR="$PWD" python3 -m build --no-isolation --skip-dependency-check --wheel
}

check() {
	PYTHONPATH="$PWD" pytest tests
}

package() {
	python3 -m installer -d "$pkgdir" dist/awesomeversion-$pkgver-py3-none-any.whl
}

sha512sums="
dbc6966f48cf001c1c8606f31c36a8e4272c6915cda5b7378c9014957f88c82870382f99861624eaaa4821f7054c3751e097e3bce2a38dc5fc9a075c4fe9ac6c  py3-awesomeversion-22.6.0.tar.gz
2f60fed1123467d581ed6ba172d25421ee3d8592729d1a922e7ba9de0ddace767bcd654acfce378bb056fd678027a27dc4a20047ef04c4c949eae89b2186d14b  version-placeholder.patch
"
